package com.ruoyi.epidemic.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.epidemic.domain.DeptUserCntDTO;
import com.ruoyi.epidemic.domain.EpidemicUserDeptBash;
import com.ruoyi.epidemic.mapper.EpidemicUserDeptBashMapper;
import com.ruoyi.epidemic.service.IEpidemicUserDeptBashService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.text.Convert;

/**
 * 疫情防控用户-部门信息（填报）Service业务层处理
 *
 * @author ruoyi
 * @date 2022-04-08
 */
@Service
public class EpidemicUserDeptBashServiceImpl implements IEpidemicUserDeptBashService
{
    @Autowired
    private EpidemicUserDeptBashMapper epidemicUserDeptBashMapper;

    /**
     * 查询疫情防控用户-部门信息（填报）
     *
     * @param id 疫情防控用户-部门信息（填报）主键
     * @return 疫情防控用户-部门信息（填报）
     */
    @Override
    public EpidemicUserDeptBash selectEpidemicUserDeptBashById(Long id)
    {
        return epidemicUserDeptBashMapper.selectEpidemicUserDeptBashById(id);
    }

    /**
     * 查询疫情防控用户-部门信息（填报）列表
     *
     * @param epidemicUserDeptBash 疫情防控用户-部门信息（填报）
     * @return 疫情防控用户-部门信息（填报）
     */
    @Override
    public List<EpidemicUserDeptBash> selectEpidemicUserDeptBashList(EpidemicUserDeptBash epidemicUserDeptBash)
    {
        return epidemicUserDeptBashMapper.selectEpidemicUserDeptBashList(epidemicUserDeptBash);
    }

    /**
     * 新增疫情防控用户-部门信息（填报）
     *
     * @param epidemicUserDeptBash 疫情防控用户-部门信息（填报）
     * @return 结果
     */
    @Override
    public int insertEpidemicUserDeptBash(EpidemicUserDeptBash epidemicUserDeptBash)
    {
        epidemicUserDeptBash.setCreateTime(DateUtils.getNowDate());
        return epidemicUserDeptBashMapper.insertEpidemicUserDeptBash(epidemicUserDeptBash);
    }

    /**
     * 修改疫情防控用户-部门信息（填报）
     *
     * @param epidemicUserDeptBash 疫情防控用户-部门信息（填报）
     * @return 结果
     */
    @Override
    public int updateEpidemicUserDeptBash(EpidemicUserDeptBash epidemicUserDeptBash)
    {
        epidemicUserDeptBash.setUpdateTime(DateUtils.getNowDate());
        return epidemicUserDeptBashMapper.updateEpidemicUserDeptBash(epidemicUserDeptBash);
    }

    /**
     * 批量删除疫情防控用户-部门信息（填报）
     *
     * @param ids 需要删除的疫情防控用户-部门信息（填报）主键
     * @return 结果
     */
    @Override
    public int deleteEpidemicUserDeptBashByIds(String ids)
    {
        return epidemicUserDeptBashMapper.deleteEpidemicUserDeptBashByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除疫情防控用户-部门信息（填报）信息
     *
     * @param id 疫情防控用户-部门信息（填报）主键
     * @return 结果
     */
    @Override
    public int deleteEpidemicUserDeptBashById(Long id)
    {
        return epidemicUserDeptBashMapper.deleteEpidemicUserDeptBashById(id);
    }

    @Override
    public EpidemicUserDeptBash selectEpidemicUserDeptBashByUserId(String userId) {
        return epidemicUserDeptBashMapper.selectEpidemicUserDeptBashByUserId(userId);
    }

    /**
     * 疫情防控用户-部门信息全部人数
     * @return 结果
     */
    @Override
    public int selectCountUser(Long deptId, String flag){
        return epidemicUserDeptBashMapper.selectCountUser(deptId, flag);
    }

    @Override
    public String getUserTypeByUserId(String userId) {
        return epidemicUserDeptBashMapper.getUserTypeByUserId(userId);
    }

    @Override
    public int selectCountUserNew(List<Long> childDeptIdList) {
        return epidemicUserDeptBashMapper.selectCountUserNew(childDeptIdList);
    }

    @Override
    public List<DeptUserCntDTO>  selectCountUserNewGroupDeptId(List<Long> childDeptIdList) {
        return epidemicUserDeptBashMapper.selectCountUserNewGroupDeptId(childDeptIdList);
    }

    @Override
    public List<String> selectCountUserIds(Long deptId, String flag) {
        return epidemicUserDeptBashMapper.selectCountUserIds(deptId, flag);
    }
}
